package com.yanqu.road.server.timer.sacrifice;

import com.yanqu.road.server.manger.sacrifice.SacrificeMgr;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class SacrificeCheckTask extends GeneralTask {

	private Logger logger = LogManager.getLogger(this.getClass().getName());

	private boolean isRun = false;

	@Override
	public void doRun() {
		try {
			SacrificeMgr.resetOneDay();
		}catch (Exception e){
			logger.error("sacrifice reset error:", e);
		}
		if(!isRun) {
			isRun = true;
			try {
				//定时任务，初始化boss血量
				SacrificeMgr.checkSacrificeDetail();
			}catch (Exception e){
				logger.error("sacrifice checkSacrificeDetail error:", e);
			}
			try {
				SacrificeMgr.sendRankReward();
			}catch (Exception e){
				logger.error("sacrifice send rank reward error:", e);
			}finally {
				isRun = false;
			}
		}
	}
}
